package cn.com.infcn.spider.domain;

public class FtpUriInfo extends UrlInfo {
	
	public String server;

	private int port;
	
	public String user;

	private String password;

	private String path;
	
	public FtpUriInfo() {
		
	}
	
	public FtpUriInfo(String server, int port, String user, String password, String path) {
		this.server = server;
		this.port = port;
		this.user = user;
		this.password = password;
		this.path = path;
	}
	
	public FtpUriInfo(FtpUriInfo parent, String path){
		this.server = parent.getServer();
		this.port = parent.getPort();
		this.user = parent.getUser();
		this.password = parent.getPassword();
		this.path = path;
		super.setFromUrl(this.getUri());
		super.setDepth(parent.getDepth() + 1);
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getServer() {
		return server;
	}

	public void setServer(String server) {
		this.server = server;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}
	
	@Override
	public String getUri() {
		return "ftp://" + this.server + ":" + this.port + "/" + this.path;
	}
	
	@Override
	public int hashCode() {
		return getUri().hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		return getUri().equals(obj);
	}


}
